from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.base import TemplateView

from .lib import (
    HTMXProjectSubCreateFormView,
    HTMXProjectSubUpdateFormView,
    ProjectSubDetailView,
    ProjectSubListView,
    template_path,
)

from .. import forms, models

class ContractListView(ProjectSubListView):
    template_name = template_path("contract/list.html")

class ContractCreateView(HTMXProjectSubCreateFormView):
    form_class = forms.ContractForm
    create_view_name = "project:contract/create"
    detail_view_name = "project:contract/detail"

class ContractDetailView(ProjectSubDetailView):
    model = models.Contract
    form_class = forms.ContractForm
    template_name = template_path("contract/detail.html")

class ContractUpdateView(HTMXProjectSubUpdateFormView):
    model = models.Contract
    form_class = forms.ContractForm
    update_view_name = "project:contract/update"
    detail_view_name = "project:contract/detail"
